package articleStudy.stream;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 题目的优化实现，采用流的方式
 */
public class StreamStrengthen {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("1", "2", "bilibili", "of", "codesheep", "5", "at", "BILIBILI", "codesheep", "23", "CHEERS", "6");

        String result=list.stream()         //首先将列表转化为Stream流
                .filter(i->!Stream.isNum(i))    //筛选出字母型字符串
                .filter(i->i.length()>=5)       //筛选出长度>=5的字符串
                .map(i->i.toLowerCase())    //字符串统一转小写
                .distinct()         //去重
                .sorted(Comparator.naturalOrder())      //排序
                .collect(Collectors.joining("♥"));  //字符串链接

        System.out.println(result);
    }
}
